var PAGE_GROUPING = 'art-grouping';
/**
 * 客户分组搜索页
 * @type _L5.Anonym$0
 */
App.View.GroupingPage = (function (lng, App) {

    var _router = App.Router;
    var _template = App.Data.Template;
    var _element = App.Data.Element;

    var $ = lng.dom;
    var $_section = $('section#' + _element.SECTIONS.GROUPING);
    var $_search_input = $_section.find('input#grouping-input-search');
    var $_grouping_list = $_section.find('ul#grouping-list');

    var loadPage = function () {

    };

    var buildCustomList = function (customs) {
        var div = '';
        for (var i = 0; i < customs.length; i++) {
            var custom = customs[i];
            div += _template.CUSTOM_ITEM.format(custom.name, custom.lastUpdate, custom.maturity, i);
        }
        if (div.isEmpty()) {
            div = _template.TOOLTIP.format("暂无客户");
        }
        $_grouping_list.html(div);
    };

    var bindListItems = function (call) {
        $_grouping_list.find('li').bind('touchend', function (e) {
            var index = this.getAttribute("data-index");
            call(index);
        });
    };

    var setSearchKeyword = function (keyword) {
        $_search_input.val(keyword);
    };

    return {
        loadPage:loadPage,
        setSearchKeyword:setSearchKeyword,
        buildCustomList:buildCustomList,
        bindListItems:bindListItems
    };
})(Lungo, App);